export class friendData {
    constructor(
        _Id: number = -1,
        _url: string = '',
        _name: string = '',
        _friendType: number = FRIEND_TYPE.notFriend,
        _phoneNum: string = '12345678910',
        _sendMsgTime: string = '1970-01-01',
        _remarkName: string = '',
        _fromType: number = SourceEnum.INVALID,
        _gender: number = GENDER.UNKNOWN,
        _reqComments: string = '',
        _isTop: boolean = false,
        _isDontBother: boolean = false,
        _unreadMsgNum: number = 0,
        _readedMsgId: number = 0,
        _isShowName: boolean = false
    ) {
        this.Id = _Id;
        this.url = _url;
        this.name = _name;
        this.remarkName = _remarkName;
        this.phoneNum = _phoneNum;
        this.friendType = _friendType;
        this.sendMsgTime = _sendMsgTime;
        this.fromType = _fromType;
        this.gender = _gender;
        this.reqComments = _reqComments;
        this.isTop = _isTop;
        this.isDontBother = _isDontBother;
        this.unreadMsgNum = _unreadMsgNum;
        this.readedMsgId = _readedMsgId;
        this.isShowName = _isShowName;
    }
    public Id: number;
    public url: string;//头像链接
    public name: string;//昵称
    public remarkName: string;//备注
    public gender: number;//0: 未知  1: 男  2: 女
    public phoneNum: string;//电话号码
    public friendType: number;//-1: 不是该平台用户(邀请)   0: 是用户, 但不是好友   1: 是好友
    public sendMsgTime: string;//给对方发送消息的时间
    public fromType: number;//添加好友/进群 时的来源类型
    public reqComments: string;//请求消息
    public sourceId: number;//用于群获取来源信息(成员ID)
    //本地存储字段
    public isTop: boolean;//是否置顶
    public isDontBother: boolean;//是否免打扰
    public unreadMsgNum: number;//未读消息数
    public readedMsgId: number;//已读最新消息
    public isShowName: boolean;//是否在聊天界面展示昵称

    public static s2cData(serverUserData: any) {
        if (serverUserData == null || serverUserData == void 0) return;
        let _userData: friendData = new friendData();
        if (!serverUserData) return _userData;
        if (serverUserData.rid != null) _userData.Id = serverUserData.rid;
        if (serverUserData.name != null) _userData.name = serverUserData.name;
        if (serverUserData.comments != null) _userData.remarkName = serverUserData.comments;
        if (serverUserData.source != null) _userData.fromType = serverUserData.source;
        if (serverUserData.sex != null) _userData.gender = serverUserData.sex;
        if (serverUserData.head != null) _userData.url = serverUserData.head;
        // if (serverUserData.phone != null) _userData.phoneNum = serverUserData.phone;
        if (serverUserData.source_id != null) _userData.sourceId = serverUserData.source_id;
        return _userData;
    }
    public static contrastData(key: string, localData: any, serverData: any) {
        key == 'isTop' ? (localData == null && (localData = false)) :
            (key == 'isDontBother' ? (localData == null && (localData = false)) :
                (key == 'unreadMsgNum' ? (localData == null && (localData = 0)) :
                    (key == 'readedMsgId' ? localData == null && (localData = 0) :
                        (key == 'isShowName' ? localData == null && (localData = false) :
                            (localData = serverData)))))
            ;
        return localData;
    }
}
export enum FRIEND_TYPE {
    notUser = -1,
    notFriend = 0,
    Friend = 1
}
// 关系来源枚举
export enum SourceEnum {
    INVALID = 0,  // 未知来源
    SEARCH_PHONE = 1,  // 查找手机号添加
    ADDR_LIST = 2,  // 通讯录添加
    QRCODE = 3,  // 扫二维码添加
    GROUP = 4,  // 通过群添加
    WECHAT = 5,  // 微信邀请添加
    SHARE = 6,  // 分享下载添加
    SEARCH_GROUP_ID = 7,  // 搜索群号
    INVITE = 8,  // 被邀请加入
}
//建立关系的方向
export enum SOURCE_DIR {
    TO_ME,  // 对方添加我
    TO_OTHER// 我添加对方
}
// 好友审批类型
export enum ApprovingEnum {
    INIT = 0, // 初始状态
    READ = 1, // 已读
    AGREE = 2, // 同意
    REJECT = 3, // 拒绝
    DELETE,     //删除
}

export enum GENDER {
    UNKNOWN,    //未知
    MALE,       //男
    FEMALE      //女
}
export enum PullTypeEnum {
    RID = 0,    // 同过rid拉取
    PHONE = 1,    // 通过手机号拉取
    NAME = 2,    // 通过名字拉取
}
// 消息类型枚举
export enum MessageEnum {
    PRIVATE_CHAT = 0,    // 私聊
    GROUP_CHAT = 1,    // 群消息
    FRIEND_REQ = 2,    // 好友请求
    GROUP_REQ = 3,    // 加群请求
    SYSTEM_NTC = 4,    // 系统通知
    CUSTOM_SVC = 5,    // 客服消息
    EFT = 6,    // 转账
    HONGBAO = 7,    // 红包
}
// 会话类型枚举
export enum ChatTypeEnum {
    PRIVATE = 0,     // 私聊
    GROUP = 1,     // 群聊
    SYSTEM_NTC = 2,     // 系统通知
    CUSTOM_SVC = 3,     // 客服对话
    FRI_REQ = 4,     // 好友请求
}
// 数据类型
export enum DataTypeEnum {
    INVALID = 0,    // 未知类型
    TEXT = 1,    // 文本
    PICTURE = 2,    // 图片
    VOICE = 3,    // 语音
    VIDEO = 4,    // 视频
    HONGBAO = 5,    // 红包
    EFT = 6,    // 转账
}
// 查看用户详情 类型
export enum CheckUserDetailType {
    CHECK_FRIEND_INFO,//查看好友信息
    CHECK_MEMBER_INFO,//查看群成员信息
    ADD_USER_FRIEND, // 添加用户为好友
    CHECK_USER_REQUEST_FRIEND,//用户请求添加好友
    CHECK_USER_REQUEST_MEMBER,//用户请求成为群成员
}

//个人中心

//代理类型(玩家, 普通代理, 大区代理)
export enum AgentType {
    regionalAgent = 1,      //大区代理
    normalAgent = 2,        //普通代理
    user = 3,               //普通用户
    playerWithoutClub,  //玩家 未加入过俱乐部
    playerWithClub,     //玩家 加入过俱乐部
    service             //客服
}
